﻿namespace CRMG.Container.Source.Variables
{
    using CRMG.ConfigurationManager;
    using CRMG.Container.Source.Helper;
    using CRMG.UserManagement.Source.BO;
    using System;

    public class AppVariables
    {
        private static User _currentUser;
        public static User CurrentUser
        {
            get { return AppVariables._currentUser; }
            set { AppVariables._currentUser = value; }
        }

        private static bool _isUserAdmin = false;
        public static bool IsUserAdmin
        {
            get { return AppVariables._isUserAdmin; }
            set { AppVariables._isUserAdmin = value; }
        }


        public static string ApplicationCulture
        {
            get
            {
                string culture = String.Empty;

                try
                {
                    culture = Configuration.AppSets["current-culture"].ToString();
                }
                catch (Exception)
                {
                    culture = "tr-TR";
                }

                return culture;
            }
        }

        public static int RowCount
        {
            get
            {
                int rowCount = Configuration.AppSets["row-count"].ToInt();
                return rowCount > 4 && rowCount < 101 ? rowCount : 20;
            }
        }

    }
}
